# Generated by Django 3.2.13 on 2022-04-19 07:57
from django.db import migrations, models
from django.db.models import F, Value
from django.db.models.functions import Concat

import apps.common.fields


def forward(apps, schema_editor):
    """
    Reformat data for the new FieldType
    """
    UserProfile = apps.get_model("user", "UserProfile")
    UserProfile.objects.update(
        languages_challenges=Concat(Value("{"), F("languages_challenges"), Value("}"))
    )


class Migration(migrations.Migration):
    dependencies = [
        ("user", "0071_userprofile_activity_cantons"),
    ]

    operations = [
        migrations.RunPython(forward),
        migrations.AlterField(
            model_name="userprofile",
            name="languages_challenges",
            field=apps.common.fields.ChoiceArrayField(
                base_field=models.CharField(
                    choices=[
                        ("fr", "French"),
                        ("de", "German"),
                        ("it", "Italian"),
                        ("en", "English"),
                    ],
                    max_length=2,
                ),
                blank=True,
                default=list,
                size=None,
                verbose_name="Prêt à animer en",
            ),
        ),
    ]
